package com.mtsmda.preparationforjavainterview.jinterview;

public class ImmutableInnerClass {
	
	public static void example(final int [] ar){
		System.out.println("Before");
		for(int c : ar){
			System.out.println(c);
		}
		final int g [] = ar;
		
		new Object(){
			public void twice(){
				for(int c : g){
					c *= 2;
				}
			}
		}.twice();
		
		System.out.println("After");
		for(int c : ar){
			System.out.println(c);
		}
	}
	
	
	public static int [] arrayTwice(int p[]){
		for(int i = 0; i < p.length; i++){
			p[i] *= 2;
		}
		return p;
	}
	
	public static void arrayPrint(int p[]){
		System.out.println("begin");
		for(int i : p){
			System.out.print(i + " ");
		}
		System.out.println("\nend");
	}
	
}